package com.project.queue.helper;

import com.project.queue.factory.QueueFactory;
import com.project.queue.tool.BaseQueue;

import java.util.Objects;

/**
 * @author mengxj
 */
public class QueueProxy extends BaseQueue {

    private static BaseQueue baseQueue;

    @Override
    public void send(String queue, String value) {
        this.checkAndInit();
        baseQueue.send(queue, value);
    }

    private void checkAndInit(){
        if(Objects.isNull(baseQueue)){
            baseQueue = QueueFactory.getInstance();
        }
    }
}
